import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class SliverIntegralDelegate extends SliverPersistentHeaderDelegate {
  final Color backgroundColor;
  final TabBar tabBar;
  final bool isEmpty;

  const SliverIntegralDelegate(
      {required this.tabBar,
        required this.backgroundColor,required this.isEmpty});

  @override
  double get minExtent => tabBar.preferredSize.height;

  @override
  double get maxExtent => tabBar.preferredSize.height;

  @override
  Widget build(context, shrinkOffset, overlapsContent) {
    return Container(
      color: Colors.transparent,
      margin: EdgeInsets.only(left: 20.w,right: 20.w),
      height: maxExtent,
      child: tabBar,
    );
  }

  @override
  bool shouldRebuild(SliverIntegralDelegate oldDelegate) {
    return tabBar != oldDelegate.tabBar;
  }
}
